package org.sixtythousand.joker.netty;

import io.netty.buffer.ByteBuf;
import io.netty.handler.codec.http.FullHttpRequest;
import org.sixtythousand.joker.http.HttpChannel;
import org.sixtythousand.joker.servlet.SimpleRequest;

import javax.servlet.http.Cookie;

/**
 * @author zhoulk
 * @date 2023/10/13 15:08
 * @desc
 */
public class NettyHttpRequest extends SimpleRequest {
    protected ByteBuf content;
    protected FullHttpRequest fullHttpRequest;

    public NettyHttpRequest(HttpChannel channel, FullHttpRequest fullHttpRequest) {
        super(channel);
        this.fullHttpRequest = fullHttpRequest;
        this.content = fullHttpRequest.content();
    }

    public FullHttpRequest getFullHttpRequest() {
        return this.fullHttpRequest;
    }

    @Override
    public Cookie[] getCookies() {
        String cookie = fullHttpRequest.headers().get("Cookie");
        return new Cookie[] {};
    }
}
